<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="application/javascript" src="case.js"></script>
</head>
<body>
<script>
<!--    序列化-->

let request = new proto.Request()
request.setContentencoding('utf-8')
request.setContenttype('gzip')


let headers1 = new proto.Headers()
headers1.setKey('user_agent')
headers1.setValue('11111111')
request.addHeaders(headers1)

let headers2 = new proto.Headers()
headers2.setKey('type')
headers2.setValue('gzip')
request.addHeaders(headers2)

let data = request.serializeBinary()


request.setPayload(data)

console.log(request.toObject())
let encode_request = request.serializeBinary()
console.log(encode_request)

// 反序列化

let decode_request = new proto.Request.deserializeBinary(encode_request)
console.log(decode_request.toObject())

let decode_payload = new proto.Request.deserializeBinary(decode_request.getPayload_asU8())
console.log(decode_payload.toObject())

</script>

</body>
</html>